<template>
  <n-config-provider
    :locale="zhCN"
    :date-locale="dateZhCN"
    inline-theme-disabled
    :theme="styles.theme"
  >
    <Loading :hidden="show" />
    <template>
      <NuxtPage v-if="layout" />
      <NuxtLayout v-else>
        <NuxtPage />
      </NuxtLayout>
    </template>
  </n-config-provider>
</template>
<script setup lang="ts">
import { zhCN, dateZhCN, NConfigProvider } from "naive-ui";
import userStore from "~/stores/user";
import styleStore from "./stores/style";
const styles = styleStore();

const user = userStore();
const route = useRoute();
const layout = ref(route.name === "login" || route.name === "enroll");
// 监控页面资源加载
const show = ref(false);

watchEffect(() => {
  layout.value = route.name === "login" || route.name === "enroll";
});
onMounted(() => {
  nextTick(() => {
    // 在DOM元素渲染完成后执行的代码
    show.value = true;
  });
});
</script>
